package net.wantongtech.xa.uploadbasicinfo.vo;

import com.wtkj.dao.annotation.DatabaseTable;
import com.wtkj.dao.annotation.PrimaryKey;
import com.wtkj.vo.AbstractValueObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.util.Date;

/**
 * @author MaShibo
 * 2021/1/12 0012
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@DatabaseTable(tableName = "TMP_DFS_FILE")
public class DfsFileEntry extends AbstractValueObject {

    public static final int DEL_FLAG_NONE = 0;

    public static final int DEL_FLAG_DONE = 1;

    @PrimaryKey
    private Integer id;

    private String path;

    private Date modifyTime;

    private Long fileSize;

    private Integer delFlag;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        DfsFileEntry that = (DfsFileEntry) o;

        return new EqualsBuilder()
                .append(id, that.id)
                .append(path, that.path)
                .append(modifyTime, that.modifyTime)
                .append(fileSize, that.fileSize)
                .append(delFlag, that.delFlag)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(id)
                .append(path)
                .append(modifyTime)
                .append(fileSize)
                .append(delFlag)
                .toHashCode();
    }
}
